package com.jiazhong.shixi.book.mapper;

import com.jiazhong.shixi.book.bean.Book;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BookMapper {

    //查询最新的5本图书
    @Select("select b.*,category_id as 'categoryId',image_name as 'imageName' from book b order by create_time desc limit 0,5")
    List<Book> time_fist();

    //查询所有的最新图示
    @Select("select b.*,category_id as 'categoryId',image_name as 'imageName' from book b order by create_time desc")
    List<Book> suoy_time_fist();

    //查询价格最低的4本图示
    @Select("select b.*,category_id as 'categoryId',image_name as 'imageName' from book b order by price asc limit 0,4")
    List<Book> low_fist();

    //查询所有价格最低的图示
    @Select("select b.*,category_id as 'categoryId',image_name as 'imageName' from book b order by price asc")
    List<Book> suoy_low_fist();

    //书名模糊查询
    @Select("select b.*,category_id as 'categoryId',image_name as 'imageName' from book b where `name` like #{name}")
    List<Book> name_fist(String name);

}
